load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("autocargo")

rust_library(
    name = "hostcaps",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {
        "cargo_toml_config": {
            "lints": {
                "rust": {
                    "unexpected_cfgs": {
                        "check-cfg": ["cfg(fbcode_build)"],
                        "level": "warn",
                    },
                },
            },
        },
    },
    crate_root = "src/lib.rs",
    deps = [
        "fbsource//third-party/rust:derive_more",
        "//common/rust/fbwhoami:fbwhoami",
    ],
)

cpp_library(
    name = "hostcaps_ffi",
    headers = ["hostcaps.h"],
    exported_deps = [
        ":hostcaps",
    ],
)

rust_binary(
    name = "test-hostcaps",
    srcs = ["src/bin/test.rs"],
    crate_root = "src/bin/test.rs",
    deps = [":hostcaps"],
)
